
<!DOCTYPE html>
<html>

	<head>
	<title>CAIJL's Blog</title>
	<meta charset="utf-8"/>
	<link rel="stylesheet" href="/font-awesome-4.7.0/css/font-awesome.min.css">

	<link rel="stylesheet" href="/bootstrap-3.3.7/css/bootstrap.min.css">
	<script src="/jquery-2.1.1/jquery.min.js"></script>
	<script src="/bootstrap-3.3.7/js/bootstrap.min.js"></script>

	<link rel="stylesheet" href="/css/bootstrap-slider.min.css">
	<script src="/js/bootstrap-slider.min.js"></script>
	
	<link rel="stylesheet" href="/css/main.css">
	<script src="/js/main.js"></script>
	
	<link rel="stylesheet" href="/css/cursor.css">
	<script src="/js/cursor.js"></script>
	
	
	<link rel="stylesheet" href="/css/code.css">
	<!--link rel="stylesheet" href="/css/markdown.css"-->
	
	<link rel="stylesheet" href="/css/head.css">

	<script src="/js/window.js"></script>
	<script src='//unpkg.com/valine/dist/Valine.min.js'></script>
	</head>
<body>

	<link rel="stylesheet" href="/katex/katex.min.css" crossorigin="anonymous">
	<script src="/katex/katex.min.js" crossorigin="anonymous"></script>
	<script src="/katex/contrib/mathtex-script-type.min.js" defer></script>
	<script defer src="/katex/contrib/auto-render.min.js"crossorigin="anonymous"
	    onload="renderMathInElement(document.body);"></script>
	<script>document.addEventListener("DOMContentLoaded", function() {renderMathInElement(document.body,{"delimiters":[{left: "$", right: "$", display: false}]});});</script>
	<nav class="navbar navbar-default header card" role="navigation" style="width: 100%;">
	<div class="container-fluid"> 
	<div class="navbar-header">
		<button type="button" class="navbar-toggle" data-toggle="collapse"
				data-target="#example-navbar-collapse">
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
		</button>
		<a class="navbar-brand" href="/"><span><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="bold">C</mi><mi mathvariant="bold">A</mi><mi mathvariant="bold">I</mi><mi mathvariant="bold">J</mi><msup><mi mathvariant="bold">L</mi><mo mathvariant="bold" lspace="0em" rspace="0em">′</mo></msup><mi mathvariant="bold">s</mi><mi mathvariant="bold">B</mi><mi mathvariant="bold">L</mi><mi mathvariant="bold">O</mi><mi mathvariant="bold">G</mi></mrow><annotation encoding="application/x-tex">\mathbf{CAIJL'sBLOG}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 0.751892em; vertical-align: 0em;"></span><span class="mord"><span class="mord mathbf">C</span><span class="mord mathbf">A</span><span class="mord mathbf">I</span><span class="mord mathbf">J</span><span class="mord"><span class="mord mathbf">L</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height: 0.751892em;"><span class="" style="top: -3.063em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathbf mtight">′</span></span></span></span></span></span></span></span></span><span class="mord mathbf">s</span><span class="mord mathbf">B</span><span class="mord mathbf">L</span><span class="mord mathbf">O</span><span class="mord mathbf">G</span></span></span></span></span></span></a>
	</div>
	<div class="collapse navbar-collapse" id="example-navbar-collapse">
		<ul class="nav navbar-nav" style="background-color:#fcfcfc">
			<li><a href="/"><i class="menu-item-icon fa fa-fw fa-home"></i>首页</a></li>
			<li><a href="/archives/"><i class="menu-item-icon fa fa-fw fa-archive"></i>文章</a></li>
			<li><a href="/tags/"><i class="menu-item-icon fa fa-fw fa-tags"></i>标签</a></li>
			<li><a href="/settings/"><i class="menu-item-icon fa fa-fw fa-cogs"></i>设置</a></li>
			<!--li><a href="/about/"><i class="menu-item-icon fa fa-fw fa-user"></i>关于</a></li-->
			<li><a href="/games/"><i class="menu-item-icon fa fa-fw fa-gamepad"></i>其它</a></li>
			

		</ul>
	</div>
	</div>
	</nav>
<div class="container">
	<div style="height: 60px;"></div>
	<div class="row" >
		<div class="col-md-8">
			<div class="panel panel-default card" style="padding: 10px;position: relative;">
                <img src='/img/bg/39.png' style="width:100%"/>
				<span style="position: absolute;left:15px;bottom:15px;width:90%;"><font class="view-text" style="color:#fcfcfc;font-size:25px">题解 P4451 【[国家集训队]整数的lqp拆分】</font><br><a href="/tags/2020/" class="tag"><span  style="background-color: rgb(52, 152, 219);">2020</span></a>&nbsp;<a href="/tags/生成函数/" class="tag"><span  style="background-color: rgb(231, 76, 60);">生成函数</span></a>&nbsp;<a href="/tags/多项式/" class="tag"><span  style="background-color: rgb(231, 76, 60);">多项式</span></a>&nbsp;<a href="/tags/NTT/" class="tag"><span  style="background-color: rgb(231, 76, 60);">NTT</span></a>&nbsp;<a href="/tags/题解/" class="tag"><span  style="background-color: rgb(82, 196, 26);">题解</span></a></span>
			</div>
			<div class="panel panel-default card" style="padding: 10px;" id="main">
                <h2 id="_1">题意</h2>
<p>
<script type="math/tex; mode=display">\large{\sum_{\small\sum_{i=1}^ma_i=n,a_i>0}}\small\prod_{i=1}^m F_{a_i}</script>
</p>
<!--more-->
<h2 id="_2">题解</h2>
<p>小清新生成函数。</p>
<p>记斐波那契数列的第<script type="math/tex">i</script>项为<script type="math/tex">fib_i</script>，那么有：<script type="math/tex">fib_0=0,fib_1=1,fib_n=fib_{n-1}+fib_{n-2}</script>
</p>
<p>令<script type="math/tex">F(x)=\sum_{i=0}^{+\infty}fib_ix^i</script>，即斐波那契的生成函数，那么显然有：</p>
<p>
<script type="math/tex; mode=display">
\begin{alignedat}{2}
F(x)&=fib_0+&fib_1\times x+&fib_2\times x^2+fib_3\times x^3+fib_4\times x^4+\ldots(1)\\
xF(x)&=&fib_0\times x+&fib_1\times x^2+fib_2\times x^3+fib_3\times x^4+\ldots(2)\\
x^2F(x)&=&&fib_0\times x^2+fib_1\times x^3+fib_2\times x^4+\ldots(3)\\
\end{alignedat}
</script>
</p>
<p>
<script type="math/tex">(2)</script>式加<script type="math/tex">(3)</script>式，由于<script type="math/tex">fib_i+fib_{i+1}=fib_{i+2}</script>，可以得到：</p>
<p>
<script type="math/tex; mode=display">(x+x^2)F(x)=fib_2\times x^2+fib_3\times x^3+fib_4\times x^4\ldots</script>
</p>
<p>与<script type="math/tex">(1)</script>式对比一下，有：</p>
<p>
<script type="math/tex; mode=display">F(x)=(x+x^2)F(x)+x</script>
</p>
<p>
<script type="math/tex; mode=display">F(x)=\frac{x}{1-x-x^2}</script>
</p>
<p>设<script type="math/tex">n</script>的答案为<script type="math/tex">g_n</script>，递推式应该比较容易。就是枚举最后的一个数字，在原来的基础上乘上这个数的斐波那契值，在累加答案，最后的式子应该就是：</p>
<p>
<script type="math/tex; mode=display">g_n=\sum_{i=1}^ng_ifib_{n-i}</script>
</p>
<p>特别地，我们令<script type="math/tex">g_0=1</script>
</p>
<p>
<script type="math/tex; mode=display">g_n=[n=0]+\sum_{i=1}^ng_ifib_{n-i}</script>
</p>
<p>设<script type="math/tex">g</script>的生成函数为<script type="math/tex">G</script>,即<script type="math/tex">G(x)=\sum_{i=0}^{+\infty}g_ix^i</script>，那么对其进行展开：</p>
<p>
<script type="math/tex; mode=display">G(x)=\sum_{n=0}^{+\infty}([n=0]+\sum_{i=1}^ng_ifib_{n-i})x^n</script>
</p>
<p>
<script type="math/tex; mode=display">G(x)=1+\sum_{n=1}^{+\infty}(\sum_{i=1}^ng_ifib_{n-i})x^n</script>
</p>
<p>不难发现，<script type="math/tex">\sum_{n=1}^{+\infty}(\sum_{i=1}^ng_ifib_{n-i})x^n=F(x)\times G(x)</script>，因此：</p>
<p>
<script type="math/tex; mode=display">G(x)=1+F(x)\times G(x)</script>
</p>
<p>
<script type="math/tex; mode=display">G(x)=\frac{1}{1-F(x)}=\frac{1}{1-\frac{1}{1-x-x^2}}</script>
</p>
<p>
<script type="math/tex; mode=display">=\frac{1-x-x^2}{1-2x-x^2}=1-\frac{x}{x^2+2x-1}</script>
</p>
<p>此时只需要展开<script type="math/tex">-\frac{x}{x^2+2x-1}</script>即可。</p>
<p>我们知道，<script type="math/tex">\frac{1}{1-cx^k}=\sum_{i=0}^{+\infty}(cx)^{ik}</script>，因此我们希望上式可以用这样的方式展开。</p>
<p>我们只需要解出<script type="math/tex">x^2+2x-1=0</script>的两根<script type="math/tex">x_1,x_2</script>，<script type="math/tex">x_{1,2}=-1±\sqrt{2}</script>,那么就有：</p>
<p>
<script type="math/tex; mode=display">-\frac{x}{x^2+2x-1}=-\frac{x}{(x-x_1)(x-x_2)}</script>
</p>
<p>
<script type="math/tex; mode=display">=\frac{x}{x_2-x_1}(\frac{1}{x-x_1}-\frac{1}{x-x_2})</script>
</p>
<p>把常数项化为<script type="math/tex">1</script>
</p>
<p>
<script type="math/tex; mode=display">=\frac{x}{x_2-x_1}(\frac{1}{x2}\times\frac{1}{1-x/x2}-\frac{1}{x1}\times\frac{1}{1-x/x1})</script>
</p>
<p>
<script type="math/tex; mode=display">=\frac{x}{x_2-x_1}(\frac{1}{x2}\times\sum_{i=0}\frac{x^i}{x_2^i}-\frac{1}{x1}\times\sum_{i=0}\frac{x^i}{x_1^i})</script>
</p>
<p>
<script type="math/tex; mode=display">=\frac{1}{x_2-x_1}(\sum_{i=0}\frac{x^{i+1}}{x_2^{i+1}}-\sum_{i=0}\frac{x^{i+1}}{x_1^{i+1}})</script>
</p>
<p>那么第<script type="math/tex">n</script>项的系数为<script type="math/tex">g(n)=\dfrac{1}{x2-x1}\times(\dfrac{1}{x_2^n}-\dfrac{1}{x_1^n})</script>
</p>
<p>代入得到：<script type="math/tex">g(n)=\dfrac{\sqrt{2}}{4}[(1+\sqrt{2})^n-(1-\sqrt{2})^n]</script>
</p>
<p>
<script type="math/tex">\sqrt2</script>在模<script type="math/tex">1000000007</script>时等于<script type="math/tex">59713600</script>或<script type="math/tex">940286407</script>。</p>
<p>但是由于<script type="math/tex">n</script>的值很大，根据费马小定理，对<script type="math/tex">mod-1</script>取模即可。</p>
<h2 id="_3">代码</h2>
<div class="highlight"><pre><span></span><code><span class="linenos" data-linenos=" 1 "></span><span class="cp">#include</span><span class="cpf">&lt;bits/stdc++.h&gt;</span><span class="cp"></span>
<span class="linenos" data-linenos=" 2 "></span><span class="k">using</span> <span class="k">namespace</span> <span class="n">std</span><span class="p">;</span>
<span class="linenos" data-linenos=" 3 "></span><span class="k">typedef</span> <span class="kt">long</span> <span class="kt">long</span> <span class="n">ll</span><span class="p">;</span>
<span class="linenos" data-linenos=" 4 "></span><span class="k">template</span><span class="o">&lt;</span><span class="k">const</span> <span class="kt">int</span> <span class="n">mod</span><span class="o">&gt;</span> 
<span class="linenos" data-linenos=" 5 "></span><span class="k">struct</span> <span class="nc">modint</span><span class="p">{</span>
<span class="linenos" data-linenos=" 6 "></span>    <span class="n">ll</span> <span class="n">x</span><span class="p">;</span>
<span class="linenos" data-linenos=" 7 "></span>    <span class="n">modint</span><span class="p">(</span><span class="n">ll</span> <span class="n">o</span><span class="o">=</span><span class="mi">0</span><span class="p">){</span><span class="n">x</span><span class="o">=</span><span class="n">o</span><span class="p">;}</span>
<span class="linenos" data-linenos=" 8 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">=</span> <span class="p">(</span><span class="n">ll</span> <span class="n">o</span><span class="p">){</span><span class="k">return</span> <span class="n">x</span><span class="o">=</span><span class="n">o</span><span class="p">,</span><span class="o">*</span><span class="k">this</span><span class="p">;}</span>
<span class="linenos" data-linenos=" 9 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">+=</span><span class="p">(</span><span class="n">modint</span> <span class="n">o</span><span class="p">){</span><span class="k">return</span> <span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="o">+</span><span class="n">o</span><span class="p">.</span><span class="n">x</span><span class="o">&gt;=</span><span class="n">mod</span><span class="o">?</span><span class="n">x</span><span class="o">+</span><span class="n">o</span><span class="p">.</span><span class="n">x</span><span class="o">-</span><span class="nl">mod</span><span class="p">:</span><span class="n">x</span><span class="o">+</span><span class="n">o</span><span class="p">.</span><span class="n">x</span><span class="p">,</span><span class="o">*</span><span class="k">this</span><span class="p">;}</span>
<span class="linenos" data-linenos="10 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">-=</span><span class="p">(</span><span class="n">modint</span> <span class="n">o</span><span class="p">){</span><span class="k">return</span> <span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="o">-</span><span class="n">o</span><span class="p">.</span><span class="n">x</span><span class="o">&lt;</span><span class="mi">0</span><span class="o">?</span><span class="n">x</span><span class="o">-</span><span class="n">o</span><span class="p">.</span><span class="n">x</span><span class="o">+</span><span class="nl">mod</span><span class="p">:</span><span class="n">x</span><span class="o">-</span><span class="n">o</span><span class="p">.</span><span class="n">x</span><span class="p">,</span><span class="o">*</span><span class="k">this</span><span class="p">;}</span>
<span class="linenos" data-linenos="11 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">*=</span><span class="p">(</span><span class="n">modint</span> <span class="n">o</span><span class="p">){</span><span class="k">return</span> <span class="n">x</span><span class="o">=</span><span class="mf">1l</span><span class="n">l</span><span class="o">*</span><span class="n">x</span><span class="o">*</span><span class="n">o</span><span class="p">.</span><span class="n">x</span><span class="o">%</span><span class="n">mod</span><span class="p">,</span><span class="o">*</span><span class="k">this</span><span class="p">;}</span>
<span class="linenos" data-linenos="12 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">^=</span><span class="p">(</span><span class="n">ll</span> <span class="n">b</span><span class="p">){</span>
<span class="linenos" data-linenos="13 "></span>        <span class="n">b</span><span class="o">%=</span><span class="p">(</span><span class="n">mod</span><span class="mi">-1</span><span class="p">);</span>
<span class="linenos" data-linenos="14 "></span>        <span class="n">modint</span> <span class="n">a</span><span class="o">=*</span><span class="k">this</span><span class="p">,</span><span class="n">c</span><span class="o">=</span><span class="mi">1</span><span class="p">;</span>
<span class="linenos" data-linenos="15 "></span>        <span class="k">for</span><span class="p">(;</span><span class="n">b</span><span class="p">;</span><span class="n">b</span><span class="o">&gt;&gt;=</span><span class="mi">1</span><span class="p">,</span><span class="n">a</span><span class="o">*=</span><span class="n">a</span><span class="p">)</span><span class="k">if</span><span class="p">(</span><span class="n">b</span><span class="o">&amp;</span><span class="mi">1</span><span class="p">)</span><span class="n">c</span><span class="o">*=</span><span class="n">a</span><span class="p">;</span>
<span class="linenos" data-linenos="16 "></span>        <span class="k">return</span> <span class="n">x</span><span class="o">=</span><span class="n">c</span><span class="p">.</span><span class="n">x</span><span class="p">,</span><span class="o">*</span><span class="k">this</span><span class="p">;</span>
<span class="linenos" data-linenos="17 "></span>    <span class="p">}</span>
<span class="linenos" data-linenos="18 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">/=</span><span class="p">(</span><span class="n">modint</span> <span class="n">o</span><span class="p">){</span><span class="k">return</span> <span class="o">*</span><span class="k">this</span> <span class="o">*=</span><span class="n">o</span><span class="o">^=</span><span class="n">mod</span><span class="mi">-2</span><span class="p">;}</span>
<span class="linenos" data-linenos="19 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">+=</span><span class="p">(</span><span class="n">ll</span> <span class="n">o</span><span class="p">){</span><span class="k">return</span> <span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="o">+</span><span class="n">o</span><span class="o">&gt;=</span><span class="n">mod</span><span class="o">?</span><span class="n">x</span><span class="o">+</span><span class="n">o</span><span class="o">-</span><span class="nl">mod</span><span class="p">:</span><span class="n">x</span><span class="o">+</span><span class="n">o</span><span class="p">,</span><span class="o">*</span><span class="k">this</span><span class="p">;}</span>
<span class="linenos" data-linenos="20 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">-=</span><span class="p">(</span><span class="n">ll</span> <span class="n">o</span><span class="p">){</span><span class="k">return</span> <span class="n">x</span><span class="o">=</span><span class="n">x</span><span class="o">-</span><span class="n">o</span><span class="o">&lt;</span><span class="mi">0</span><span class="o">?</span><span class="n">x</span><span class="o">-</span><span class="n">o</span><span class="o">+</span><span class="nl">mod</span><span class="p">:</span><span class="n">x</span><span class="o">-</span><span class="n">o</span><span class="p">,</span><span class="o">*</span><span class="k">this</span><span class="p">;}</span>
<span class="linenos" data-linenos="21 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">*=</span><span class="p">(</span><span class="n">ll</span> <span class="n">o</span><span class="p">){</span><span class="k">return</span> <span class="n">x</span><span class="o">=</span><span class="mf">1l</span><span class="n">l</span><span class="o">*</span><span class="n">x</span><span class="o">*</span><span class="n">o</span><span class="o">%</span><span class="n">mod</span><span class="p">,</span><span class="o">*</span><span class="k">this</span><span class="p">;}</span>
<span class="linenos" data-linenos="22 "></span>    <span class="n">modint</span> <span class="o">&amp;</span><span class="k">operator</span> <span class="o">/=</span><span class="p">(</span><span class="n">ll</span> <span class="n">o</span><span class="p">){</span><span class="k">return</span> <span class="o">*</span><span class="k">this</span> <span class="o">*=</span> <span class="p">((</span><span class="n">modint</span><span class="p">(</span><span class="n">o</span><span class="p">))</span><span class="o">^=</span><span class="n">mod</span><span class="mi">-2</span><span class="p">);}</span>
<span class="linenos" data-linenos="23 "></span>    <span class="k">template</span><span class="o">&lt;</span><span class="k">class</span> <span class="nc">I</span><span class="o">&gt;</span><span class="k">friend</span> <span class="n">modint</span> <span class="k">operator</span> <span class="o">+</span><span class="p">(</span><span class="n">modint</span> <span class="n">a</span><span class="p">,</span><span class="n">I</span> <span class="n">b</span><span class="p">){</span><span class="k">return</span> <span class="n">a</span><span class="o">+=</span><span class="n">b</span><span class="p">;}</span>
<span class="linenos" data-linenos="24 "></span>    <span class="k">template</span><span class="o">&lt;</span><span class="k">class</span> <span class="nc">I</span><span class="o">&gt;</span><span class="k">friend</span> <span class="n">modint</span> <span class="k">operator</span> <span class="o">-</span><span class="p">(</span><span class="n">modint</span> <span class="n">a</span><span class="p">,</span><span class="n">I</span> <span class="n">b</span><span class="p">){</span><span class="k">return</span> <span class="n">a</span><span class="o">-=</span><span class="n">b</span><span class="p">;}</span>
<span class="linenos" data-linenos="25 "></span>    <span class="k">template</span><span class="o">&lt;</span><span class="k">class</span> <span class="nc">I</span><span class="o">&gt;</span><span class="k">friend</span> <span class="n">modint</span> <span class="k">operator</span> <span class="o">*</span><span class="p">(</span><span class="n">modint</span> <span class="n">a</span><span class="p">,</span><span class="n">I</span> <span class="n">b</span><span class="p">){</span><span class="k">return</span> <span class="n">a</span><span class="o">*=</span><span class="n">b</span><span class="p">;}</span>
<span class="linenos" data-linenos="26 "></span>    <span class="k">template</span><span class="o">&lt;</span><span class="k">class</span> <span class="nc">I</span><span class="o">&gt;</span><span class="k">friend</span> <span class="n">modint</span> <span class="k">operator</span> <span class="o">/</span><span class="p">(</span><span class="n">modint</span> <span class="n">a</span><span class="p">,</span><span class="n">I</span> <span class="n">b</span><span class="p">){</span><span class="k">return</span> <span class="n">a</span><span class="o">/=</span><span class="n">b</span><span class="p">;}</span>
<span class="linenos" data-linenos="27 "></span>    <span class="k">friend</span> <span class="n">modint</span> <span class="k">operator</span> <span class="o">^</span><span class="p">(</span><span class="n">modint</span> <span class="n">a</span><span class="p">,</span><span class="n">ll</span> <span class="n">b</span><span class="p">){</span><span class="k">return</span> <span class="n">a</span><span class="o">^=</span><span class="n">b</span><span class="p">;}</span>
<span class="linenos" data-linenos="28 "></span>    <span class="k">friend</span> <span class="kt">bool</span> <span class="k">operator</span> <span class="o">==</span><span class="p">(</span><span class="n">modint</span> <span class="n">a</span><span class="p">,</span><span class="n">ll</span> <span class="n">b</span><span class="p">){</span><span class="k">return</span> <span class="n">a</span><span class="p">.</span><span class="n">x</span><span class="o">==</span><span class="n">b</span><span class="p">;}</span>
<span class="linenos" data-linenos="29 "></span>    <span class="k">friend</span> <span class="kt">bool</span> <span class="k">operator</span> <span class="o">!=</span><span class="p">(</span><span class="n">modint</span> <span class="n">a</span><span class="p">,</span><span class="n">ll</span> <span class="n">b</span><span class="p">){</span><span class="k">return</span> <span class="n">a</span><span class="p">.</span><span class="n">x</span><span class="o">!=</span><span class="n">b</span><span class="p">;}</span>
<span class="linenos" data-linenos="30 "></span>    <span class="kt">bool</span> <span class="k">operator</span> <span class="o">!</span> <span class="p">()</span> <span class="p">{</span><span class="k">return</span> <span class="o">!</span><span class="n">x</span><span class="p">;}</span>
<span class="linenos" data-linenos="31 "></span>    <span class="n">modint</span> <span class="k">operator</span> <span class="o">-</span> <span class="p">()</span> <span class="p">{</span><span class="k">return</span> <span class="n">x</span><span class="o">?</span><span class="n">mod</span><span class="o">-</span><span class="nl">x</span><span class="p">:</span><span class="mi">0</span><span class="p">;}</span>
<span class="linenos" data-linenos="32 "></span>    <span class="kt">void</span> <span class="n">read</span><span class="p">(){</span>
<span class="linenos" data-linenos="33 "></span>        <span class="n">string</span> <span class="n">s</span><span class="p">;</span><span class="n">cin</span><span class="o">&gt;&gt;</span><span class="n">s</span><span class="p">;</span><span class="n">x</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span>
<span class="linenos" data-linenos="34 "></span>        <span class="k">for</span><span class="p">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="n">i</span><span class="o">&lt;</span><span class="n">s</span><span class="p">.</span><span class="n">length</span><span class="p">();</span><span class="n">i</span><span class="o">++</span><span class="p">)</span>
<span class="linenos" data-linenos="35 "></span>            <span class="o">*</span><span class="k">this</span><span class="o">*=</span><span class="mi">10</span><span class="p">,</span><span class="o">*</span><span class="k">this</span><span class="o">+=</span><span class="n">s</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">-</span><span class="sc">&#39;0&#39;</span><span class="p">;</span>
<span class="linenos" data-linenos="36 "></span>    <span class="p">}</span><span class="kt">void</span> <span class="n">write</span><span class="p">(){</span>
<span class="linenos" data-linenos="37 "></span>        <span class="n">cout</span><span class="o">&lt;&lt;</span><span class="n">x</span><span class="p">;</span>
<span class="linenos" data-linenos="38 "></span>    <span class="p">}</span>
<span class="linenos" data-linenos="39 "></span><span class="p">};</span>
<span class="linenos" data-linenos="40 "></span><span class="n">modint</span><span class="o">&lt;</span><span class="mi">1000000006</span><span class="o">&gt;</span><span class="n">n</span><span class="p">;</span>
<span class="linenos" data-linenos="41 "></span><span class="n">modint</span><span class="o">&lt;</span><span class="mi">1000000007</span><span class="o">&gt;</span><span class="n">ans</span><span class="p">,</span><span class="n">sqrt2</span><span class="o">=</span><span class="mi">59713600</span><span class="p">;</span>
<span class="linenos" data-linenos="42 "></span><span class="kt">signed</span> <span class="nf">main</span><span class="p">(){</span>
<span class="linenos" data-linenos="43 "></span>    <span class="n">n</span><span class="p">.</span><span class="n">read</span><span class="p">();</span>
<span class="linenos" data-linenos="44 "></span>    <span class="n">ans</span><span class="o">=</span><span class="n">sqrt2</span><span class="o">/</span><span class="mi">4</span><span class="o">*</span><span class="p">(((</span><span class="n">sqrt2</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span><span class="o">^</span><span class="n">n</span><span class="p">.</span><span class="n">x</span><span class="p">)</span><span class="o">-</span><span class="p">((</span><span class="o">-</span><span class="n">sqrt2</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span><span class="o">^</span><span class="n">n</span><span class="p">.</span><span class="n">x</span><span class="p">));</span><span class="n">ans</span><span class="p">.</span><span class="n">write</span><span class="p">();</span>
<span class="linenos" data-linenos="45 "></span>    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="linenos" data-linenos="46 "></span><span class="p">}</span>
</code></pre></div>
			</div>
			<div class="panel panel-default card" style="padding: 10px;height: 50px;font-size: 20px;">
				<a style="float: left;" href="\article\P4491.html"><i class="fa fa-angle-double-left"></i></a><a style="float: right;" href="\article\P6271.html"><i class="fa fa-angle-double-right"></i></a>
			</div>
			<div class="panel panel-default card" style="padding: 10px;font-size: 20px;" id="vcomments">
				
			</div>
			<script>
				new Valine({
					el: '#vcomments',
					appId: 'PAlFUPg0pQVTFTEo8gCB4BCf-gzGzoHsz',
					appKey: 'U38ejnLUiizJ6vLyp6ql4hRq',
					path: window.location.pathname
				})
			</script>
		</div>
		<div class="col-md-3">
				<div class="panel panel-default card">
				<div class="panel-heading">
					<h3 class="panel-title">
						<i class="fa fa-info"></i>&emsp;
						<strong>文章信息</strong>
					</h3>
				</div>
                <div style="margin: 10px;">
                    <div style="margin-top: 8px;display: flex;"> 
    <span style="flex: 1 0 auto;margin-right: 6px;">标题</span>
    <span><font style="font-weight: bold">题解 P4451 【[国家集训队]整数的lqp拆分】</font></span>
	</div><div style="margin-top: 8px;display: flex;"> 
    <span style="flex: 1 0 auto;margin-right: 6px;">日期</span>
    <span>2020-12-26 18:19:00</span>
	</div>
                </div>
				</div>
				<div class="panel panel-default card">
				<div class="panel-heading">
					<h3 class="panel-title">
						<i class="fa fa-tag"></i>&emsp;
						<strong>标签</strong>
					</h3>
				</div>
				<div style="margin: 10px;">
					<a href="/tags/2020/" class="tag"><span  style="background-color: rgb(52, 152, 219);">2020</span></a>&nbsp;<a href="/tags/生成函数/" class="tag"><span  style="background-color: rgb(231, 76, 60);">生成函数</span></a>&nbsp;<a href="/tags/多项式/" class="tag"><span  style="background-color: rgb(231, 76, 60);">多项式</span></a>&nbsp;<a href="/tags/NTT/" class="tag"><span  style="background-color: rgb(231, 76, 60);">NTT</span></a>&nbsp;<a href="/tags/题解/" class="tag"><span  style="background-color: rgb(82, 196, 26);">题解</span></a>
				</div>
				</div>
				
			<div class="panel panel-default card">
					<div class="panel-heading">
						<h3 class="panel-title">
							<i class="fa fa-user-circle-o"></i>&emsp;
							<strong>caijicjl</strong>
						</h3>
					</div>
					<div style="width: 60%;display: inline-block;padding-top: 10px;">
						<ul class="propertyLinks" style="list-style-type: none;">
							<li>
								<img style="vertical-align:middle;position:relative;top:-2px" src="/img/rating-16x16.png">
								Rating:&nbsp;
								<span style="font-weight:bold;color: gray ">312</span>
							</li>
							<li>
								<img style="vertical-align:middle;position:relative;top:-2px" src="/img/star_blue_16.png">
								Contribution:&nbsp;
								<span style="color:gray;font-weight:bold;">0</span>
							</li>
						</ul>
						<ul class="nav-links">
							<li><a href="/settings/">Settings</a></li>
							<li><a href="/archives/">Blog</a></li>
							<li><a href="/teams">Teams</a></li>
							<li><a href="/submissions/dingdingsb">Submissions</a></li>
							<li><a href="/usertalk">Talks</a></li>
							<li><a href="/contests/with/dingdingsb">Contests</a></li>
						</ul>
					</div>
					<div style="display:inline-block;vertical-align: top;margin: 10px;text-align: center;">
						<div style="height:50px;width:50px"><img src="/img/avatar.png"/></div>
						<div><a href="https://www.luogu.com.cn/user/174304" style="font-weight:bold;color:gray">caijicjl</a></div>
					</div>
				</div>
		<div class="panel panel-default card">
				<div class="panel-heading">
					<h3 class="panel-title">
						<i class="fa fa-external-link"></i>&emsp;
						<strong>画中画</strong>
					</h3>
				</div>
				<div style="width:100%;margin:10px">
				<input type="text" id="url"/>
				<input value="创建" type="button" onclick="creat('kk')" /> 
				</div>
		</div>
		<script src="/js/hitokoto.js"></script>
							

				
				<span id="kk"></span>
				<div  id="myScrollspy" class="card" style="width: 100%;"  data-spy="affix">
					<script src="/js/make_toc.js"></script>
				</div>
		</div>
	</div>
 </div>
</body>
</html>
